﻿using System;
using System.Collections.Generic;
using System.Text;
using ArgusLib.FFmpeg.avutil;

namespace System.Drawing
{
	public static class ArgusExtensions
	{
		public static AVPixelFormat GetAVPixelFormat(this Image image)
		{
			if (image.PixelFormat == Imaging.PixelFormat.Format16bppArgb1555)
				return AVPixelFormat.AV_PIX_FMT_RGB555LE;
			if (image.PixelFormat == Imaging.PixelFormat.Format16bppGrayScale)
				return AVPixelFormat.AV_PIX_FMT_GRAY16LE;
			if (image.PixelFormat == Imaging.PixelFormat.Format16bppRgb555)
				return AVPixelFormat.AV_PIX_FMT_NONE;
			if (image.PixelFormat == Imaging.PixelFormat.Format16bppRgb565)
				return AVPixelFormat.AV_PIX_FMT_RGB565LE;
			if (image.PixelFormat == Imaging.PixelFormat.Format1bppIndexed)
				return AVPixelFormat.AV_PIX_FMT_NONE;
			if (image.PixelFormat == Imaging.PixelFormat.Format24bppRgb)
				return AVPixelFormat.AV_PIX_FMT_RGB24;
			if (image.PixelFormat == Imaging.PixelFormat.Format32bppArgb)
				return AVPixelFormat.AV_PIX_FMT_BGRA;
			if (image.PixelFormat == Imaging.PixelFormat.Format32bppPArgb)
				return AVPixelFormat.AV_PIX_FMT_NONE;
			if (image.PixelFormat == Imaging.PixelFormat.Format32bppRgb)
				return AVPixelFormat.AV_PIX_FMT_RGB0;
			if (image.PixelFormat == Imaging.PixelFormat.Format48bppRgb)
				return AVPixelFormat.AV_PIX_FMT_RGB48LE;
			if (image.PixelFormat == Imaging.PixelFormat.Format4bppIndexed)
				return AVPixelFormat.AV_PIX_FMT_NONE;
			if (image.PixelFormat == Imaging.PixelFormat.Format64bppArgb)
				return AVPixelFormat.AV_PIX_FMT_NONE;
			if (image.PixelFormat == Imaging.PixelFormat.Format64bppPArgb)
				return AVPixelFormat.AV_PIX_FMT_NONE;
			if (image.PixelFormat == Imaging.PixelFormat.Format8bppIndexed)
				return AVPixelFormat.AV_PIX_FMT_NONE;

			return AVPixelFormat.AV_PIX_FMT_NONE;
		}
	}
}
